#ifndef PATIENTWIDGET_H
#define PATIENTWIDGET_H

#include <QWidget>
#include <QJsonObject>
#include "../../../Common/models.h"
#include "../../../Common/protocol.h"

class QListWidget;

namespace Ui {
class PatientWidget;
}

class PatientWidget : public QWidget {
    Q_OBJECT
    
public:
    explicit PatientWidget(const Patient& patient, QWidget *parent = nullptr);
    ~PatientWidget();
    
private slots:
    void on_profileTab_clicked();
    void on_appointmentTab_clicked();
    void on_medicalRecordsTab_clicked();
    void on_prescriptionsTab_clicked();
    void on_medicineSearchTab_clicked();
    void on_chatTab_clicked();
    void on_notificationButton_clicked();  // 通知中心
    void onMessageReceived(MessageType type, const QJsonObject& data);
    
private:
    void loadPatientInfo();
    void updateNotificationList(const QJsonArray& notifications);
    
    Ui::PatientWidget *ui;
    Patient m_patient;
    int m_unreadNotificationCount;  // 未读通知数量
    QListWidget* m_notificationList;  // 通知列表（保存指针以便更新）
};

#endif // PATIENTWIDGET_H

